#include "ShaderGuiColor.h"
#include "base.h"

ShaderGuiColor::ShaderGuiColor(void)
{
}
ShaderGuiColor::~ShaderGuiColor(void)
{
}
string ShaderGuiColor::GetUniqueShaderName()
{
	return "blockSolid";
}
bool ShaderGuiColor::Initialize()
{
	if(!BaseShaderProgram::Initialize("guiProjection.vs", "guiSolid.fs")) 
			return false;

	uf_color = glGetUniformLocation(m_nProgramName, "color");
	uf_matWorld = glGetUniformLocation(m_nProgramName, "world");
	uf_matView = glGetUniformLocation(m_nProgramName, "view");
	uf_matProjection = glGetUniformLocation(m_nProgramName, "projection");
	uf_vecSize = glGetUniformLocation(m_nProgramName, "size");
	in_vert = glGetAttribLocation(m_nProgramName, "position");

	return true;
}
int ShaderGuiColor::GetVertexLocation() const
{
	return in_vert;
}
void ShaderGuiColor::SetSize(const vector2 &size)
{
	glUniform2f(uf_vecSize, size.x, size.y);
}
void ShaderGuiColor::SetColor(const color &color)
{
	glUniform4f(uf_color, color.fR(), color.fG(), color.fB(), color.fA());
}
void ShaderGuiColor::SetProjection(const matrix &m)
{
	glUniformMatrix4fv(uf_matProjection, 1, g_bMatrixTransposed, m.DataPtr());
}
void ShaderGuiColor::SetView(const matrix &m)
{
	glUniformMatrix4fv(uf_matView, 1, g_bMatrixTransposed, m.DataPtr());
}
void ShaderGuiColor::SetWorld(const matrix &m)
{
	glUniformMatrix4fv(uf_matWorld, 1, g_bMatrixTransposed, m.DataPtr());
}